package com.sx.manage.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sx.cache.Cache;
import com.sx.cache.Session;
import com.sx.model.constants.MSystemConstants;

/**
 * 包装 登录 session
 * 
 * @author lenovo
 *
 */
public class SessionManager {

	private SessionManager() {

	}

	@SuppressWarnings("static-access")
	public static Session instance(HttpServletRequest request, HttpServletResponse response, Cache redisCache) {
		Session session = Session.instance(request, response, redisCache);
		String token = session.get_token();
		session.setTOKEN_NAME(MSystemConstants.TOKEN_MANAGER);
		session.set_token(token);
		return session;
	}

	@SuppressWarnings("static-access")
	public static Session createtoken(HttpServletRequest request, HttpServletResponse response, Cache redisCache) {
		Session session = Session.createtoken(request, response, redisCache,null);
		String token = session.get_token();
		session.setTOKEN_NAME(MSystemConstants.TOKEN_MANAGER);
		session.set_token(token);
		return session;
	}
}
